pathbar: fix positioning of the down slider button
authorCosimo Cecchi <cosimoc@gnome.org>
Sun, 25 Aug 2013 03:17:09 +0000 (20:17 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 31 Aug 2013 21:25:49 +0000 (17:25 -0400)
So that it's always linked with the rest of the pathbar.

https://bugzilla.gnome.org/show_bug.cgi?id=706722

gtk/gtkpathbar.c

index f9135b54061217d3dc2a948f8c83ab6d95bdb531..70f124d6426cfdc96a2320e1d387a2a2cb6801df 100644 (file)
@@ -537,6 +537,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   gint allocation_width;
   gboolean need_sliders = FALSE;
   gint up_slider_offset = 0;
+  gint down_slider_offset = 0;
   GtkRequisition child_requisition;
   gboolean needs_reorder = FALSE;
 
@@ -703,8 +704,15 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       gtk_widget_set_child_visible (child, TRUE);
       gtk_widget_size_allocate (child, &child_allocation);
 
-      if (direction == GTK_TEXT_DIR_LTR)
-       child_allocation.x += child_allocation.width;
+      if (direction == GTK_TEXT_DIR_RTL)
+        {
+          down_slider_offset = child_allocation.x - allocation->x - path_bar->priv->slider_width;
+        }
+      else
+        {
+          down_slider_offset += child_allocation.width;
+          child_allocation.x += child_allocation.width;
+        }
     }
   /* Now we go hide all the widgets that don't fit */
   while (list)
@@ -730,6 +738,9 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->up_slider_button) == FALSE;
       gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
       gtk_widget_show_all (path_bar->priv->up_slider_button);
+
+      if (direction == GTK_TEXT_DIR_LTR)
+        down_slider_offset += path_bar->priv->slider_width;
     }
   else
     {
@@ -740,13 +751,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   if (need_sliders)
     {
       child_allocation.width = path_bar->priv->slider_width;
-
-      if (direction == GTK_TEXT_DIR_RTL)
-       child_allocation.x = 0;
-      else
-       child_allocation.x = allocation->width - path_bar->priv->slider_width;
-
-      child_allocation.x += allocation->x;
+      child_allocation.x = down_slider_offset + allocation->x;
       
       gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);